﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TravelWeb.Models;

namespace TravelWeb.Controllers
{
    public class HomeController : Controller
    {
        private TravelWebDB db = new TravelWebDB();

        public ActionResult Index()
        {
            ViewBag.Message = String.Empty;

            return View();
        }

        public ActionResult About()
        {
            return View();
        }

        public ActionResult EditInfo(string username)
        {
            foreach (var item in db.Customers)
            {
                if (item.Username.Equals(username))
                    return RedirectToAction("Edit", "Customer", new { id = item.CustomerId });
            }
            return RedirectToAction("Index", "Home");
        }
    }
}
